package com.lms.desiginmode.singleton;

/**
 * @Author: 李孟帅
 * @CreateTime: 2020-12-10 14:21
 * @Description:  双重检查：线程安全、懒加载、效率高
 */
public class SingletonObject4 {
    private static volatile SingletonObject4 instance;

    private SingletonObject4() {
    }

    public static SingletonObject4 getInstance() {
        if (instance == null) {
            synchronized (SingletonObject4.class){
                if (instance==null){
                    return new SingletonObject4();
                }
            }
        }
        return instance;
    }
}
